package outlookBar;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Icon;
import javax.swing.JButton;

/**
 * This is a default implementation of the section header using a javax.swing.JButton
 * @see #OutlookBar
 * @see #BarHeader
 * @see #BarSection
 * @author Carlos E. Descalzi
 */
public class DefaultBarHeader extends BarHeader {

	private JButton label = new JButton();

	/**
	 * Default constructor
	 * @param text the title
	 * @param icon the icon
	 **/
	public DefaultBarHeader(String text,Icon icon){
		setLayout(new BorderLayout());
		add(label,BorderLayout.CENTER);
		label.setText(text);
		label.setIcon(icon);
		
		setOpaque(false);
		
		label.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent event){
				fireActionPerformed(DefaultBarHeader.this);
			}
		});
	}
	
	public void setBackground(Color color){
		label.setBackground(color);
	}
	
	public Color getBackground(){
		return label.getBackground();
	}

	public void setForeground(Color color){
		label.setForeground(color);
	}
	
	public Color getForeground(){
		return label.getForeground();
	}
	
	public Font getFont(){
		return label.getFont();
	}
	
	public void setFont(Font font){
		label.setFont(font);
	}
}
